#ifndef MENUPLUGIN_H
#define MENUPLUGIN_H

#include <QGenericPlugin>
#include <peony-qt/menu-plugin-iface.h>
#include <QtCore/qglobal.h>
#include <QAction>

namespace Peony {

class MenuPlugin : public QGenericPlugin, public MenuPluginInterface
{
    Q_OBJECT
    Q_PLUGIN_METADATA(IID QGenericPluginFactoryInterface_iid FILE "encrypt-decrypt-menu-plugin.json")

public:
    explicit MenuPlugin(QObject *parent = nullptr);

    bool is_encrypted_file(QString file_name);

    PluginInterface::PluginType pluginType() override {return PluginInterface::MenuPlugin;}
    const QString name() override {return QString(tr("Peony-Qt filesafe menu Extension"));}
    const QString description() override {return tr("filesafe Menu Extension.");}
    const QIcon icon() override {return QIcon::fromTheme("application-zip");}
    void setEnable(bool enable) override { m_enable = enable; }
    bool isEnable() override {return m_enable;}

    QString testPlugin() override {return "test menuplgin";}
    QList<QAction *> menuActions(Types types, const QString &uri, const QStringList &selectionUris) override;

private:
    QObject *create(const QString &name, const QString &spec) override;

    bool encryptedFileExist(const QStringList &selecttionUris);

    bool m_enable;
};

}


#endif // MENUPLUGIN_H
